$(function() {
  $.ajax({
      url:"/shop-api/userInfo/info?"+parseInt(Math.random()*100000),
      type:"GET",
      success:function (resp) {
          if(resp.code==0){

              saveLoginUser(resp.data);
              Drawing(resp.data);
          }else if (resp.code==-1){
              alert(resp.message)
          }
      },
      dataType:"json"
  })
    function Drawing(data) {
        console.log("渲染成功");
        console.log(data);
        $(".status.signature").html(data.signature);
        $(".title.title--h4").html(data.name);
        $(".email").html(data.email);
        $(".phone").html(data.phone);
        $(".location").html(data.location);
        $(".birthday").html(data.birthday);
        $(".header__photo-img.portrait").attr("src",data.portrait);

    }
    //存入用户信息
    function saveLoginUser(user) {
      console.log("存入信息到缓存");
        let loginUserJson = JSON.stringify(user);
        sessionStorage.setItem("login_user", loginUserJson);
    }
})